package com.example.service;

import com.example.entity.Ordersetting;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mapper.OrdersettingMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class OrdersettingService extends ServiceImpl<OrdersettingMapper, Ordersetting> {

    @Resource
    private OrdersettingMapper ordersettingMapper;

    public List<Ordersetting> enableOrdersetting(){
        List<Ordersetting> ordersettings = ordersettingMapper.enableOrdersetting();
        return ordersettings;
    }
    public Ordersetting orderByDate(Date orderDate){
        return  ordersettingMapper.orderByDate(orderDate);
    }

    public int updateOrderByDate(Ordersetting ordersetting){
        return  ordersettingMapper.updateOrderByDate(ordersetting);
    }


    // 批量 导入 excel 数据
    public void add(List<Ordersetting> ordersettingList) {
        for (Ordersetting ordersetting : ordersettingList) {
            Ordersetting ordersetting1 = ordersettingMapper.orderByDate(ordersetting.getOrderDate());

            ordersettingMapper.insert(ordersetting);
        }
    }
}